package 曾世昌12_8.zuoye8;

import org.apache.commons.io.FileUtils;

import java.io.File;
import java.lang.reflect.Constructor;
import java.lang.reflect.Method;
import java.util.List;

public class test {
    public static void main(String[] args) throws Exception {
        Class<?> aClass = Class.forName( "rc.mxdx3_zhoumozuoye.zuoye8.Cat" );
        Method setName = aClass.getDeclaredMethod( "setName", String.class );
        setName.setAccessible( true );
        Constructor<?> constructor = aClass.getConstructor();
        Object o = constructor.newInstance();
        List<String> strings = FileUtils.readLines( new File( "E:\\untitled5\\src\\rc\\mxdx3_zhoumozuoye\\zuoye8\\CatData.txt" ), "utf-8" );
        for (int i = 0; i < strings.size(); i++) {
            String str = "";
            char[] chars = strings.get( i ).toCharArray();
            for (int i1 = 0; i1 < chars.length; i1++) {
                if (chars[i1] == '‘' || chars[i1] == '’') {
                    continue;
                }
                str += chars[i1];
            }
            String[] s = str.split( " " );
            for (int i1 = 0; i1 < s.length; i1++) {
                String[] split = s[i1].split( "=" );
                for (int i2 = 0; i2 < split.length; i2++) {
                    if (split[0].equals( "name" )) {
                        setName.invoke( o, split[1] );
                    }
                }
            }
        }
    }
}
